extern GRRLIB_texImg *tx_button;
extern GRRLIB_texImg *tx_window;
extern GRRLIB_texImg *tx_custom[GUI_BUTTON_NUM];
extern FontColor wgui_fc;
extern FontColor text_fc;
extern FontColor about_fc;
extern u32 disabled_color;
extern const Pos pos_auto;
extern const Pos pos_fill;
extern const Pos pos_full;
extern struct Wgui_Input winput;
extern int wgui_inited;
void wgui_init();
void wgui_DrawWindowBase(GRRLIB_texImg *tx, int x, int y, int w, int h, u32 color);
void wgui_DrawWindow(GRRLIB_texImg *tx, int x, int y, int w, int h,
		u32 window_color, u32 color, float txt_scale, char *title);
void wgui_DrawButtonBase(GRRLIB_texImg *tx,float x,float y,float w,float h,float zoom,u32 color,int state);
float _wgui_DrawButton(GRRLIB_texImg *tx,int x,int y,int w,int h,u32 color,int state,float txt_scale,char *txt);
void wgui_input_save2(ir_t *ir, int *p_buttons);
void wgui_input_save();
void wgui_input_set(ir_t *ir, int *buttons, int *held);
void wgui_input_steal2(ir_t *ir,int *buttons);
void wgui_input_steal_buttons();
void wgui_input_steal();
void wgui_input_restore(ir_t *ir,int *buttons);
void wgui_input_get();
bool wgui_over_widget(Widget *ww,ir_t *ir);
bool wgui_over(Widget *ww);
void traverse_children1(Widget *ww,void(*fun)(Widget *));
void traverse1(Widget *ww,void(*fun)(Widget *));
void traverse_children(Widget *ww,void(*fun)(Widget *,int),int val);
void traverse(Widget *ww,void(*fun)(Widget *,int),int val);
void traverse_linked(Widget *ww,void(*fun2)(Widget *,int),int val);
void traverse_linked_children(Widget *ww,void(*fun2)(Widget *,int),int val);
void wgui_update(Widget *ww);
void wgui_action(Widget *ww);
int wgui_set_value_local_simple(Widget *ww,int flags,int val);
int wgui_set_value_local_x(Widget *ww,int flags,int val);
int wgui_set_value_local(Widget *ww,int flags,int val);
int wgui_propagate_value(Widget *ww,int flags,int val);
int wgui_set_value(Widget *ww,int val);
void wgui_link_value(Widget *a,Widget *b);
void wgui_unlink_value(Widget *a);
void wgui_set_value_list(Widget *ww, int n, char **values);
void wgui_remove(Widget *ww);
void wgui_remove(Widget *ww);
void wgui_remove_children(Widget *ww);
void wgui_close(Widget *ww);
Widget *wgui_handle(Widget *ww);
Widget *wgui_handle(Widget *ww);
Widget *wgui_handle_children(Widget *ww);
void wgui_render(Widget *ww);
void wgui_render(Widget *ww);
void wgui_render_children(Widget *ww);
Pos pos(int x,int y,int w,int h);
Pos pos_xy(int x,int y);
Pos pos_x(int x);
Pos pos_y(int y);
Pos pos_wh(int w,int h);
Pos pos_w(int w);
Pos pos_h(int h);
Pos pos_get(Widget *ww);
void pos_init(Widget *ww);
int pos_margin(Widget *ww,int margin);
void pos_pad(Widget *ww,int pad);
void pos_prefsize(Widget *ww,int w,int h);
void pos_reset(Widget *ww);
void pos_move(Widget *ww,int x,int y);
void pos_move_x(Widget *ww,int x);
void pos_move_y(Widget *ww,int y);
void pos_move_to(Widget *ww,int x,int y);
void pos_move_pos(Widget *ww,Pos p);
void pos_move_abs(Widget *ww,int x,int y);
int pos_avail_w(Widget *ww);
int pos_avail_h(Widget *ww);
void pos_newlines(Widget *ww,int lines);
void pos_newline(Widget *ww);
int pos_simple_w(Widget *ww,int x,int pw);
int pos_simple_h(Widget *ww,int y,int ph);
int pos_simple_x(Widget *parent,int px,int *pw);
int pos_simple_y(Widget *parent,int py,int *ph);
void pos_simple(Widget *ww,Pos *p);
int pos_auto_only_w(Widget *parent,Pos p);
int pos_auto_w(int x,Widget *parent,Pos p);
int pos_auto_x(int *pw,Widget *parent,Pos p);
int pos_auto_only_h(Widget *parent,Pos p);
int pos_auto_h(int y,Widget *parent,Pos p);
int pos_auto_y(int *ph,Widget *parent,Pos p);
void pos_auto_default(Pos *p,char *name);
void pos_auto_expand(Widget *parent,Pos *p);
void pos_columns(Widget *ww,int cols,int pw);
void pos_rows(Widget *ww,int rows,int ph);
void Widget_init(Widget *ww,Widget *parent,Pos p,char *name);
Widget *wgui_add(Widget *parent,Pos p,char *name);
int wgui_link(Widget *link,Widget *ww);
int wgui_link_count(Widget *ww);
Widget *wgui_link_get(Widget *ww,int index);
void wgui_set_state(Widget *ww,int state);
void wgui_set_inactive(Widget *ww,int cond);
void wgui_set_disabled(Widget *ww,int cond);
Widget *wgui_primary_parent(Widget *parent);
Widget *wgui_find_child_type(Widget *ww,int type);
Widget *wgui_find_parent_type(Widget *ww,int type);
int handle_B_close(Widget *ww);
void action_close_parent(Widget *ww);
void action_close_parent_dialog(Widget *ww);
void wgui_set_color(Widget *ww,int color);
void adjust_position(Widget *ww);
void update_val_from_ptr_int(Widget *ww);
void update_val_from_ptr_bool(Widget *ww);
void update_val_from_ptr_int_active(Widget *ww);
void action_write_val_ptr_int(Widget *ww);
void action_write_val_ptr_bool(Widget *ww);
void wgui_action_change_parent_val(Widget *ww);
float text_round_scale_w(float scale,int dir);
float text_h_to_scale(int h);
float pos_text_w(int len,float scale);
float text_scale_fit(int w,int h,int len,float scale);
float get_text_scale_fit_button(Widget *ww,int len,float scale);
float text_scale_fit_button(Widget *ww,int len,float scale);
void pos_auto_textlen(Pos *p,int len,float scale);
Pos pos_get_prefsize(Widget *parent,Pos p);
float pos_auto_text_scale_h(int h);
float pos_auto_text_scale(Widget *parent,Pos p);
void wgui_render_str(Widget *ww,char *str,float add_zoom,u32 color);
void wgui_render_text(Widget *ww);
float pos_auto_text(Widget *parent,Pos *p,const char *name);
Widget *wgui_add_text(Widget *parent,Pos p,const char *name);
void wgui_textbox_coords(Widget *ww,int *fw,int *fh,int *rows,int *cols);
void wgui_render_textbox(Widget *ww);
void wgui_textbox_wordwrap(Widget *ww,char *text,int strsize);
Widget *wgui_add_textbox(Widget *parent,Pos p,int font_h,char *text,int strsize);
void wgui_render_num(Widget *ww);
Widget *wgui_add_num(Widget *parent,Pos p,char *fmt,int base);
void wgui_render_dialog(Widget *ww);
void pos_init_dialog(Widget *ww);
void text_scale_fit_dialog(Widget *ww);
void wgui_dialog_ini(Widget *dialog);
void wgui_dialog_init(Widget *dialog,Pos p,char *title);
Widget *wgui_add_dialog(Widget *parent,Pos p,char *name);
int wgui_handle_button(Widget *ww);
float wgui_DrawButton(Widget *ww,char *str);
void wgui_render_button(Widget *ww);
int button_auto_w(Widget *parent,Pos p,char *name);
void pos_auto_button(Pos *p,char *name);
float pos_auto_button_scale_len(Widget *parent,Pos *p,int len);
float pos_auto_button_scale(Widget *parent,Pos *p,char *name);
Widget *wgui_add_button(Widget *parent,Pos p,char *name);
int wgui_handle_checkbox(Widget *ww);
void wgui_RenderCheckbox(Widget *ww);
Widget* wgui_add_checkboxx(Widget *parent, Pos p, char *name, bool show_name, char *off, char *on);
Widget *wgui_add_checkbox(Widget *parent,Pos p,char *name,bool show_name);
int wgui_handle_radio(Widget *ww);
void wgui_render_radio(Widget *ww);
Widget *wgui_add_radio(Widget *parent,Widget *radio,Pos p,char *name);
void wgui_radio_set(Widget *ww,int val);
Widget *wgui_auto_radio2(Widget *parent,Widget *rr,int cols,int n,char *names[]);
Widget *wgui_auto_radio(Widget *parent,int cols,int n,char *names[]);
Widget *wgui_auto_radio_a(Widget *parent,int cols,int n,...);
char *get_longest_str(int num,char *str[]);
void pos_arrange_radio(Widget *parent,Pos *p,int cols,int rows,int n,char *names[]);
Widget *wgui_arrange_radio(Widget *parent,Pos p,int cols,int n,char *names[]);
Widget *wgui_arrange_radio_a(Widget *parent,Pos p,int cols,int n,...);
int wgui_set_value_page(Widget *ww,int flags,int val);
void wgui_render_page(Widget *ww);
Widget *wgui_add_page(Widget *parent,Widget *page,Pos p,char *name);
Widget *wgui_add_pages(Widget *parent,Pos p,int num,char *name);
Widget *wgui_page_get(Widget *page,int index);
void wgui_link_page_ctrl(Widget *page,Widget *ctrl);
Widget *wgui_add_pages_ctrl(Widget *parent,Pos p,Widget *ctrl,char *name);
int wgui_num_expected_len(char *fmt,int expected_max);
Widget *wgui_add_numswitch(Widget *parent,Pos p,char *fmt,int base,int expected_max);
Widget *wgui_numswitch_get_element(Widget *ww,int dir);
Widget *wgui_add_pgswitchx(Widget *parent,Widget *page,Pos p,char *name,int pad_len,char *fmt,int expected_max);
Widget *wgui_add_pgswitch(Widget *parent,Widget *page,Pos p,char *name);
int wgui_set_value_listbox(Widget *ww,int flags,int val);
void wgui_render_listbox(Widget *ww);
void wgui_listbox_set_values(Widget *ww,int n,char **values);
float pos_auto_listbox(Widget *parent,Pos *p,int n,char **values);
Widget *wgui_add_listbox1(Widget *parent,Pos p,char *name,int n,char **values);
Widget *wgui_add_listbox(Widget *parent,Pos p,int n,char **values);
void wgui_render_listboxx(Widget *ww);
bool wgui_action_listboxx_base(Widget *ww);
Widget *wgui_listboxx_open_dialog(Widget *ww);
void wgui_listboxx_init_dialog(Widget *dd,Widget *ll);
void wgui_action_listboxx(Widget *ww);
Widget *wgui_add_listboxx(Widget *parent,Pos p,char *name,int n,char **values);
Widget *wgui_paginate_radio(Widget *parent,Pos p,int cols,int rows,int n,char *names[]);
void wgui_action_superbox(Widget *ww);
Widget *wgui_add_superbox(Widget *parent,Pos p,char *name,int n,char **values);
Widget *wgui_add_label(Widget *parent,Pos p,char *name);
void pos_auto_opt(Widget *parent,Pos *p,int pad,char *name,int num,char **values);
wgui_Option wgui_add_option_base(Widget *parent,Pos p,int pad,float w_ratio,char *name);
wgui_Option wgui_add_option(Widget *parent,Pos p,int pad,float w_ratio,char *name,int num,char **values);
Widget *wgui_add_opt(Widget *parent,char *name,int num,char **values);
Widget *wgui_add_opt_button(Widget *parent,char *name,char *value);
Widget *wgui_add_opt_a(Widget *parent,char *name,int num,...);
Widget *wgui_add_opt_map(Widget *parent,char *name,struct TextMap *map);
Widget *wgui_add_opt_array(Widget *parent,char *name,int num,int size,char array[][size]);
